////////////////////////////////////////////////////////
// SecondTown.cpp
////////////////////////////////////////////////////////

#include <d3d8.h>
#include "constants.h"
#include "MyEngine.h"
#include "SecondTown.h"

extern CMyEngine g_Engine;
extern BOOL bGotUniform;

////////////////////////////////////////////////////////
// HandleSecondTown()
////////////////////////////////////////////////////////
void HandleSecondTown()
{
    switch (g_Engine.GetPlayer()->GetSector())
    {
    case SECONDTOWNGANJEKENTRANCE:
        g_Engine.SaveGame(FALSE);
        g_Engine.GetPlayer()->SetSector(1079);
        g_Engine.OpenMapFiles("GanjekWilds.map", FALSE);
        g_Engine.SetCurrentMap(GANJEKWILDS);
        g_Engine.GetCDirect3DObj()->SetCurrentTileSurface
            (g_Engine.GetCDirect3DObj()->GetWildernessTileSurface());
        g_Engine.ResetAnimation();
        break;
    case GUARDEDSECTOR01:
    case GUARDEDSECTOR02:
    case GUARDEDSECTOR03:
        if (!bGotUniform)
        {
            g_Engine.TurnOnPlaque(
"The Second Town guards arrest\n\
you as a spy. You're thrown\n\
into jail for life. Game over!");
            g_Engine.SetPlayerDead();
        }
        break;
    }
}
